package adapletplugin.editors.input;

import objects.MappingFile;
import sections.ISection;
import sections.ISection.Section;

public class MapTableInput
{

	private Section curSection;
	private MappingFile fMap;

	public MapTableInput(MappingFile mapFile, Section section)
	{
		fMap = mapFile;
		curSection = section;
	}

	public MappingFile getMap()
	{
		return fMap;
	}

	public Section getSection()
	{
		return curSection;
	}

	public void updateSection(Section section)
	{
		curSection = section;
	}

	public Object[] getData()
	{
		ISection section = null;

		switch (curSection)
		{
		case TABLE:
			section = fMap.getTableSection();
			break;
		case TYPE:
			section = fMap.getTypeSection();
			break;
		case REF_TYPE:
			section = fMap.getReferenceTypeSection();
			break;
		case REL:
			section = fMap.getRelationshipSection();
			break;
		case REL_TO_REL:
			section = fMap.getRelToRelSection();
			break;
		case INTERFACE:
			section = fMap.getInterfaceSection();
			break;
		case FILE:
			section = fMap.getFileSection();
			break;
		default:
			return new Object[0];
		}

		return section.getObjects();
	}

}
